package com.tianhao.luo.simplefactory;

import com.tianhao.luo.product.Iphone;
import junit.framework.TestCase;
import org.junit.Test;

/**
 * @ClassName: SimpleFactoryTest2
 * @Description: 静态工厂测试类
 * @author: tianhao.luo@hand-china.com
 * @date: 2020/7/1  10:06
 */
public class SimpleFactoryTest2 extends TestCase {
    @Test
    public void testStaticFactory(){
        //静态工厂来，通过给定的条件决定生成哪种产品；而
        //产品的类型已经写死了。
        Iphone byType = SimpleFactory.createByType("a");
        if (null != byType) {
            byType.productSayHello();
        }
    }
}